function submitForm(selector, webType) {
    var isSubmit = $(selector).attr('data-is_submit');
    if (isSubmit == 'true') {
        if (webType == 'pc') {
            layer.alert('您已提交，若想再次提交请刷新页面', {
                title: '温馨提示',
                icon: 2,
                skin: 'layui-layer-red',
                area: ['380px', '160px'],
                time: 3000,
            });
            return false;
        } else if (webType == 'm') {
            layer.open({
                content: '您已提交，若想再次提交请刷新页面',
                time: 3,
                btn: '确认'
            });
            return false;
        }
    }
    var postData = {};
    $.each($(selector).serializeArray(), function () {
        postData[this.name] = this.value;
        if (this.name == 'field_mapping_data') {
            var fieldMappingData = JSON.parse(this.value);
            for (var i in fieldMappingData) {
                if (fieldMappingData[i].html_type == 5) {
                    var checkboxValue = '';
                    $(selector + ' input:checkbox[name=' + i + ']:checked').each(function (k, v) {
                        checkboxValue += ',' + $(this).val();
                    });
                    postData[i] = checkboxValue.substring(1);
                }
            }
        }
    });
    $.ajax({
        url: '/form/submit',
        method: 'POST',
        data: postData,
        dataType: 'JSON',
        success: function (response) {
            if (response.code == 1) {
                $(selector).attr('data-is_submit', 'true');
                var fieldMappingData = JSON.parse(postData['field_mapping_data']);
                for (var i in fieldMappingData) {
                    switch (fieldMappingData[i].html_type) {
                        case 1:
                            $(selector + ' input[name=' + i + ']').val('');
                            break;
                        case 3:
                            $(selector + ' textarea[name=' + i + ']').val('');
                            break;
                        case 4:
                            $(selector + ' input:radio[name=' + i + ']').eq(0).prop('checked', true);
                            break;
                        case 5:
                            $(selector + ' input:checkbox[name=' + i + ']').prop('checked', false);
                            break;
                        case 6:
                            $(selector + ' select[name=' + i + ']  option').eq(0).prop('selected', true);
                            break;
                    }
                }
                if (webType == 'pc') {
                    layer.alert(response.msg, {
                        title: '温馨提示',
                        icon: 1,
                        skin: 'layui-layer-red',
                        area: ['380px', '160px'],
                        time: 3000,
                    });
                } else if (webType == 'm') {
                    layer.open({
                        content: response.msg,
                        time: 3,
                        btn: '确认'
                    });
                }
            } else {
                if (webType == 'pc') {
                    switch (response.html_type) {
                        case 1:
                            layer.tips(response.msg, selector + ' input[name=' + response.field_name + ']', {
                                tips: [1, '#034794'],
                                time: 3000,
                            });
                            break;
                        case 3:
                            layer.tips(response.msg, selector + ' textarea[name=' + response.field_name + ']', {
                                tips: [1, '#034794'],
                                time: 3000,
                            });
                            break;
                        case 4:
                        case 5:
                        case 6:
                            layer.msg(response.msg, {icon: 2, time: 3000});
                            break;
                    }
                } else if (webType == 'm') {
                    layer.open({
                        content: response.msg,
                        time: 3,
                        btn: '确认'
                    });
                }
            }
        }
    });
}